<template>
    <div id="app">

        <el-card class="box-card">
            <el-descriptions title="用户信息" :column="3">
                <el-descriptions-item label="证件照">
                    <img :src="loginAdmin.hardUrl" height="100px" width="75px"/>
                </el-descriptions-item>
                <el-descriptions-item label="账号">{{loginAdmin.account}}</el-descriptions-item>
                <el-descriptions-item label="姓名">{{loginAdmin.name}}</el-descriptions-item>
                <el-descriptions-item label="身份证号">{{loginAdmin.idCard}}</el-descriptions-item>
                <el-descriptions-item label="手机号">{{loginAdmin.phone}}</el-descriptions-item>
                <el-descriptions-item label="加入时间">{{loginAdmin.createTime}}</el-descriptions-item>
                <el-descriptions-item label="状态">
                    <el-tag type="warning" size="mini" effect="dark" v-if="loginAdmin.state==1">在职</el-tag>
                    <el-tag type="info" effect="dark" size="mini" v-if="loginAdmin.state==0">离职</el-tag>
                </el-descriptions-item>
                <el-descriptions-item label="学历">{{loginAdmin.education}}</el-descriptions-item>
                <el-descriptions-item label="功能">
                    <el-button type="success"  size="mini" @click="addEmp" >修改个人信息</el-button>
                </el-descriptions-item>
            </el-descriptions>
            <div class="text item">
                <el-collapse @change="handleChange" accordion>
                    <el-collapse-item title="详细信息" name="1">
                        <div>{{loginAdmin.introduction}}</div>
                    </el-collapse-item>
                    <el-collapse-item title="荣誉" name="2">
                        <div>{{loginAdmin.prize}}</div>
                    </el-collapse-item>
                </el-collapse>
            </div>
        </el-card>

    </div>
</template>

<script>
    export default {
        name: "myList",
        data() {
            return{
                loginAdmin:{},
            }
        },
        created() {
            window.parent.addTabFunction(this.$route.path,"我的主页")
            this.initUser();
        },
        methods: {
            //初始化用户信息
            initUser(){
                this.$http.get("/system/admin/adminMS").then(result=>{
                    // console.log("+++++++++++++++++++++++++++++++++++")
                    // console.log(result)
                    if(result.data.code === 200){

                        this.loginAdmin = result.data.data;
                    }
                })
            },

            addEmp(){
                this.$router.push({ path: '/editMyList' })
            },

            handleChange(val) {
                console.log(val);
            },
        },
    }
</script>

<style scoped>
    #app{
        border: 1px solid #DCDFE6;
        width: 800px;
        margin: 30px auto;
        padding: 35px 35px 15px 35px;
        border-radius: 5px;
        -webkit-border-radius: 5px;
        -moz-border-radius: 5px;
        box-shadow: 0 0 25px #909399;
    }
    .text {
        font-size: 14px;
    }

    .item {
        padding: 18px 0;
    }

    .box-card {
        width: 800px;
    }
</style>